﻿using System;
using System.Data;
using System.Text;
using System.Data.SqlClient;
using jnpic.DBUtility;//Please add references
namespace jnpic.DAL
{
	/// <summary>
	/// 数据访问类:userinfo
	/// </summary>
	public partial class userinfo
	{
		public userinfo()
		{}
		#region  BasicMethod

		/// <summary>
		/// 得到最大ID
		/// </summary>
		public int GetMaxId()
		{
		return DbHelperSQL.GetMaxID("uid", "userinfo"); 
		}

		/// <summary>
		/// 是否存在该记录
		/// </summary>
		public bool Exists(int uid)
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("select count(1) from userinfo");
			strSql.Append(" where uid=@uid");
			SqlParameter[] parameters = {
					new SqlParameter("@uid", SqlDbType.Int,4)
			};
			parameters[0].Value = uid;

			return DbHelperSQL.Exists(strSql.ToString(),parameters);
		}
        public bool Exists(string  uname)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select count(1) from userinfo");
            strSql.Append(" where uname=@uname");
            SqlParameter[] parameters = {
					new SqlParameter("@uname", SqlDbType.NVarChar,20)
			};
            parameters[0].Value = uname;

            return DbHelperSQL.Exists(strSql.ToString(), parameters);
        }


		/// <summary>
		/// 增加一条数据
		/// </summary>
		public int Add(jnpic.Model.userinfo model)
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("insert into userinfo(");
			strSql.Append("uname,upwd,utruename,uphone,uemail,uunit,utel,uprovince,ucity,ucounty,uadd,ulevel,utype,remark,cuid)");
			strSql.Append(" values (");
            strSql.Append("@uname,@upwd,@utruename,@uphone,@uemail,@uunit,@utel,@uprovince,@ucity,@ucounty,@uadd,@ulevel,@utype,@remark,@cuid)");
            strSql.Append(";select SCOPE_IDENTITY()");
			SqlParameter[] parameters = {
					new SqlParameter("@uname", SqlDbType.NVarChar,20),
					new SqlParameter("@upwd", SqlDbType.NVarChar,20),
					new SqlParameter("@utruename", SqlDbType.NVarChar,10),
					new SqlParameter("@uphone", SqlDbType.VarChar,20),
					new SqlParameter("@uemail", SqlDbType.VarChar,30),
					new SqlParameter("@uunit", SqlDbType.NVarChar,50),
					new SqlParameter("@utel", SqlDbType.NVarChar,20),
					new SqlParameter("@uprovince", SqlDbType.NVarChar,10),
					new SqlParameter("@ucity", SqlDbType.NVarChar,20),
					new SqlParameter("@ucounty", SqlDbType.NVarChar,20),
					new SqlParameter("@uadd", SqlDbType.NVarChar,50),
					new SqlParameter("@ulevel", SqlDbType.Int,4),
					new SqlParameter("@utype", SqlDbType.VarChar,10),
					new SqlParameter("@remark", SqlDbType.NVarChar,50),
                    new SqlParameter("@cuid", SqlDbType.Int,4)};
			parameters[0].Value = model.uname;
			parameters[1].Value = model.upwd;
			parameters[2].Value = model.utruename;
			parameters[3].Value = model.uphone;
			parameters[4].Value = model.uemail;
			parameters[5].Value = model.uunit;
			parameters[6].Value = model.utel;
			parameters[7].Value = model.uprovince;
			parameters[8].Value = model.ucity;
			parameters[9].Value = model.ucounty;
			parameters[10].Value = model.uadd;
			parameters[11].Value = model.ulevel;
			parameters[12].Value = model.utype;
			parameters[13].Value = model.remark;
            parameters[14].Value = model.cuid;
			object obj = DbHelperSQL.GetSingle(strSql.ToString(),parameters);
			if (obj == null)
			{
				return 0;
			}
			else
			{
				return Convert.ToInt32(obj);
			}
		}
        public bool Updatea(jnpic.Model.userinfo model)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("update userinfo set ");
            strSql.Append("uname=@uname,");
            strSql.Append("upwd=@upwd,");
            strSql.Append("utruename=@utruename,");
            strSql.Append("uphone=@uphone,");
            strSql.Append("uemail=@uemail,");
            strSql.Append("uunit=@uunit,");
            strSql.Append("utel=@utel,");
            strSql.Append("uprovince=@uprovince,");
            strSql.Append("ucity=@ucity,");
            strSql.Append("ucounty=@ucounty,");
            strSql.Append("uadd=@uadd,");
            strSql.Append("ulevel=@ulevel,");
            strSql.Append("utype=@utype,");
            strSql.Append("remark=@remark");
            strSql.Append(" where uid=@uid");
            SqlParameter[] parameters = {
					new SqlParameter("@uname", SqlDbType.NVarChar,20),
					new SqlParameter("@upwd", SqlDbType.NVarChar,20),
					new SqlParameter("@utruename", SqlDbType.NVarChar,10),
					new SqlParameter("@uphone", SqlDbType.VarChar,20),
					new SqlParameter("@uemail", SqlDbType.VarChar,30),
					new SqlParameter("@uunit", SqlDbType.NVarChar,50),
					new SqlParameter("@utel", SqlDbType.NVarChar,20),
					new SqlParameter("@uprovince", SqlDbType.NVarChar,10),
					new SqlParameter("@ucity", SqlDbType.NVarChar,20),
					new SqlParameter("@ucounty", SqlDbType.NVarChar,20),
					new SqlParameter("@uadd", SqlDbType.NVarChar,50),
                    new SqlParameter("@ulevel", SqlDbType.Int,4),
					new SqlParameter("@utype", SqlDbType.VarChar,10),
					new SqlParameter("@remark", SqlDbType.NVarChar,50),
					new SqlParameter("@uid", SqlDbType.Int,4)};
            parameters[0].Value = model.uname;
            parameters[1].Value = model.upwd;
            parameters[2].Value = model.utruename;
            parameters[3].Value = model.uphone;
            parameters[4].Value = model.uemail;
            parameters[5].Value = model.uunit;
            parameters[6].Value = model.utel;
            parameters[7].Value = model.uprovince;
            parameters[8].Value = model.ucity;
            parameters[9].Value = model.ucounty;
            parameters[10].Value = model.uadd;
            parameters[11].Value = model.ulevel;
            parameters[12].Value = model.utype;
            parameters[13].Value = model.remark;
            parameters[14].Value = model.uid; 

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
            if (rows > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }
		/// <summary>
		/// 更新一条数据
		/// </summary>
		public bool Update(jnpic.Model.userinfo model)
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("update userinfo set ");
			strSql.Append("uname=@uname,");
			strSql.Append("upwd=@upwd,");
			strSql.Append("utruename=@utruename,");
			strSql.Append("uphone=@uphone,");
			strSql.Append("uemail=@uemail,");
			strSql.Append("uunit=@uunit,");
			strSql.Append("utel=@utel,");
			strSql.Append("uprovince=@uprovince,");
			strSql.Append("ucity=@ucity,");
			strSql.Append("ucounty=@ucounty,");
			strSql.Append("uadd=@uadd,");
            //strSql.Append("ulevel=@ulevel,");
			strSql.Append("utype=@utype,");
			strSql.Append("remark=@remark");
			strSql.Append(" where uid=@uid");
			SqlParameter[] parameters = {
					new SqlParameter("@uname", SqlDbType.NVarChar,20),
					new SqlParameter("@upwd", SqlDbType.NVarChar,20),
					new SqlParameter("@utruename", SqlDbType.NVarChar,10),
					new SqlParameter("@uphone", SqlDbType.VarChar,20),
					new SqlParameter("@uemail", SqlDbType.VarChar,30),
					new SqlParameter("@uunit", SqlDbType.NVarChar,50),
					new SqlParameter("@utel", SqlDbType.NVarChar,20),
					new SqlParameter("@uprovince", SqlDbType.NVarChar,10),
					new SqlParameter("@ucity", SqlDbType.NVarChar,20),
					new SqlParameter("@ucounty", SqlDbType.NVarChar,20),
					new SqlParameter("@uadd", SqlDbType.NVarChar,50),
                    //new SqlParameter("@ulevel", SqlDbType.Int,4),
					new SqlParameter("@utype", SqlDbType.VarChar,10),
					new SqlParameter("@remark", SqlDbType.NVarChar,50),
					new SqlParameter("@uid", SqlDbType.Int,4)};
			parameters[0].Value = model.uname;
			parameters[1].Value = model.upwd;
			parameters[2].Value = model.utruename;
			parameters[3].Value = model.uphone;
			parameters[4].Value = model.uemail;
			parameters[5].Value = model.uunit;
			parameters[6].Value = model.utel;
			parameters[7].Value = model.uprovince;
			parameters[8].Value = model.ucity;
			parameters[9].Value = model.ucounty;
			parameters[10].Value = model.uadd;
			parameters[11].Value = model.utype;
			parameters[12].Value = model.remark;
			parameters[13].Value = model.uid;
			//parameters[14].Value = 

			int rows=DbHelperSQL.ExecuteSql(strSql.ToString(),parameters);
			if (rows > 0)
			{
				return true;
			}
			else
			{
				return false;
			}
		}
        public bool Updatepass(int uid,string oldpass,string newpass)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("update userinfo set ");
            strSql.Append("upwd=@upwd ");            
            strSql.Append(" where uid=@uid and upwd=@oupwd");
            SqlParameter[] parameters = {
					new SqlParameter("@upwd", SqlDbType.NVarChar,20),
					new SqlParameter("@uid", SqlDbType.Int,4),
                    new SqlParameter("@oupwd", SqlDbType.NVarChar,20)
                                        };
            parameters[0].Value =newpass;
            parameters[1].Value = uid;
            parameters[2].Value = oldpass;            
            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
            if (rows > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }
        public bool Updatemyinfo(jnpic.Model.userinfo model)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("update userinfo set ");            
            strSql.Append("utruename=@utruename,");
            strSql.Append("uphone=@uphone,");
            strSql.Append("uemail=@uemail,");            
            strSql.Append("utel=@utel,");           
            strSql.Append("uadd=@uadd");            
            strSql.Append(" where uid=@uid");
            SqlParameter[] parameters = {					
					new SqlParameter("@utruename", SqlDbType.NVarChar,10),
					new SqlParameter("@uphone", SqlDbType.VarChar,20),
					new SqlParameter("@uemail", SqlDbType.VarChar,30),					
					new SqlParameter("@utel", SqlDbType.NVarChar,20),					
					new SqlParameter("@uadd", SqlDbType.NVarChar,50),                    
					new SqlParameter("@uid", SqlDbType.Int,4)};
            parameters[0].Value = model.utruename;
            parameters[1].Value = model.uphone;
            parameters[2].Value = model.uemail;
            parameters[3].Value = model.utel;
            parameters[4].Value = model.uadd;
            parameters[5].Value = model.uid;
            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
            if (rows > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }
		/// <summary>
		/// 删除一条数据
		/// </summary>
		public bool Delete(int uid)
		{
			
			StringBuilder strSql=new StringBuilder();
			strSql.Append("delete from userinfo ");
			strSql.Append(" where uid=@uid");
			SqlParameter[] parameters = {
					new SqlParameter("@uid", SqlDbType.Int,4)
			};
			parameters[0].Value = uid;
            string sql1 = "delete from farmRecord where uid=@uid";
            string sql2 = "delete from routineRecord where uid=@uid";
            string sql3 = "delete from toolsRecord where uid=@uid";
            //string sql4 = "delete from farmRecord where uid=@uid";
            DbHelperSQL.ExecuteSql(sql1, parameters);
            DbHelperSQL.ExecuteSql(sql2, parameters);
            DbHelperSQL.ExecuteSql(sql3, parameters);
			int rows=DbHelperSQL.ExecuteSql(strSql.ToString(),parameters);
			if (rows > 0)
			{
				return true;
			}
			else
			{
				return false;
			}
		}
		/// <summary>
		/// 批量删除数据
		/// </summary>
		public bool DeleteList(string uidlist )
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("delete from userinfo ");
			strSql.Append(" where uid in ("+uidlist + ")  ");
			int rows=DbHelperSQL.ExecuteSql(strSql.ToString());
			if (rows > 0)
			{
				return true;
			}
			else
			{
				return false;
			}
		}


		/// <summary>
		/// 得到一个对象实体
		/// </summary>
		public jnpic.Model.userinfo GetModel(int uid)
		{
			
			StringBuilder strSql=new StringBuilder();
			strSql.Append("select  top 1 uid,uname,upwd,utruename,uphone,uemail,uunit,utel,uprovince,ucity,ucounty,uadd,ulevel,utype,remark from userinfo ");
			strSql.Append(" where uid=@uid");
			SqlParameter[] parameters = {
					new SqlParameter("@uid", SqlDbType.Int,4)
			};
			parameters[0].Value = uid;

			jnpic.Model.userinfo model=new jnpic.Model.userinfo();
			DataSet ds=DbHelperSQL.Query(strSql.ToString(),parameters);
			if(ds.Tables[0].Rows.Count>0)
			{
				return DataRowToModel(ds.Tables[0].Rows[0]);
			}
			else
			{
				return null;
			}
		}
        public DataSet Login(string name,string pwd)
        {

            StringBuilder strSql = new StringBuilder();
            strSql.Append("select  top 1 uid,uname,utruename,uprovince,ucity,ucounty,ulevel,utype,uadd from userinfo ");
            strSql.Append(" where uname=@uname and upwd=@upwd");
            SqlParameter[] parameters = {
					new SqlParameter("@uname", SqlDbType.NVarChar,20),
					new SqlParameter("@upwd", SqlDbType.NVarChar,20)
			};
            parameters[0].Value =name;
            parameters[1].Value = pwd;

            jnpic.Model.userinfo model = new jnpic.Model.userinfo();
            return  DbHelperSQL.Query(strSql.ToString(), parameters);
            
        }
        public jnpic.Model.userinfo Login(string name, string pwd,int i)
        {

            StringBuilder strSql = new StringBuilder();
            strSql.Append("select  top 1 * from userinfo ");
            strSql.Append(" where uname=@uname and upwd=@upwd");
            SqlParameter[] parameters = {
					new SqlParameter("@uname", SqlDbType.NVarChar,20),
					new SqlParameter("@upwd", SqlDbType.NVarChar,20)
			};
            parameters[0].Value = name;
            parameters[1].Value = pwd;

            jnpic.Model.userinfo model = new jnpic.Model.userinfo();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);
            if (ds.Tables[0].Rows.Count > 0)
            {
                return DataRowToModel(ds.Tables[0].Rows[0]);
            }
            else
            {
                return null;
            }

        }
        /// <summary>
        /// 通过用户名直接获取dataset
        /// </summary>
        /// <param name="name"></param>
        /// <param name="pwd"></param>
        /// <returns></returns>
        public DataSet LoginData(int id)
        {

            StringBuilder strSql = new StringBuilder();
            strSql.Append("select  top 1 uid,uname,utruename,uprovince,ucity,ucounty,ulevel,utype,uadd from userinfo ");
            strSql.Append(" where uid=@uid");
            SqlParameter[] parameters = {
					new SqlParameter("@uid", SqlDbType.Int,4)
			};
            parameters[0].Value = id;


            jnpic.Model.userinfo model = new jnpic.Model.userinfo();
            return DbHelperSQL.Query(strSql.ToString(), parameters);

        }
        /// <summary>
        /// 通过用户名直接登录
        /// </summary>
        /// <param name="name"></param>
        /// <returns></returns>
        public jnpic.Model.userinfo Login(int uid)
        {

            StringBuilder strSql = new StringBuilder();
            strSql.Append("select  top 1 * from userinfo ");
            strSql.Append(" where uid=@uid ");
            SqlParameter[] parameters = {
					new SqlParameter("@uid", SqlDbType.Int,4)
			};
            parameters[0].Value = uid;

            jnpic.Model.userinfo model = new jnpic.Model.userinfo();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);
            if (ds.Tables[0].Rows.Count > 0)
            {
                return DataRowToModel(ds.Tables[0].Rows[0]);
            }
            else
            {
                return null;
            }

        }


		/// <summary>
		/// 得到一个对象实体
		/// </summary>
		public jnpic.Model.userinfo DataRowToModel(DataRow row)
		{
			jnpic.Model.userinfo model=new jnpic.Model.userinfo();
			if (row != null)
			{
				if(row["uid"]!=null && row["uid"].ToString()!="")
				{
					model.uid=int.Parse(row["uid"].ToString());
				}
				if(row["uname"]!=null)
				{
					model.uname=row["uname"].ToString();
				}
				if(row["upwd"]!=null)
				{
					model.upwd=row["upwd"].ToString();
				}
				if(row["utruename"]!=null)
				{
					model.utruename=row["utruename"].ToString();
				}
				if(row["uphone"]!=null)
				{
					model.uphone=row["uphone"].ToString();
				}
				if(row["uemail"]!=null)
				{
					model.uemail=row["uemail"].ToString();
				}
				if(row["uunit"]!=null)
				{
					model.uunit=row["uunit"].ToString();
				}
				if(row["utel"]!=null)
				{
					model.utel=row["utel"].ToString();
				}
				if(row["uprovince"]!=null)
				{
					model.uprovince=row["uprovince"].ToString();
				}
				if(row["ucity"]!=null)
				{
					model.ucity=row["ucity"].ToString();
				}
				if(row["ucounty"]!=null)
				{
					model.ucounty=row["ucounty"].ToString();
				}
				if(row["uadd"]!=null)
				{
					model.uadd=row["uadd"].ToString();
				}
				if(row["ulevel"]!=null && row["ulevel"].ToString()!="")
				{
					model.ulevel=int.Parse(row["ulevel"].ToString());
				}
				if(row["utype"]!=null)
				{
					model.utype=row["utype"].ToString();
				}
				if(row["remark"]!=null)
				{
					model.remark=row["remark"].ToString();
				}
			}
			return model;
		}

		/// <summary>
		/// 获得数据列表
		/// </summary>
		public DataSet GetList(string strWhere)
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("select uid,uname,upwd,utruename,uphone,uemail,uunit,utel,uprovince,ucity,ucounty,uadd,ulevel,utype,remark ");
			strSql.Append(" FROM userinfo ");
			if(strWhere.Trim()!="")
			{
				strSql.Append(" where "+strWhere);
			}
			return DbHelperSQL.Query(strSql.ToString());
		}

		/// <summary>
		/// 获得前几行数据
		/// </summary>
		public DataSet GetList(int Top,string strWhere,string filedOrder)
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("select ");
			if(Top>0)
			{
				strSql.Append(" top "+Top.ToString());
			}
			strSql.Append(" uid,uname,upwd,utruename,uphone,uemail,uunit,utel,uprovince,ucity,ucounty,uadd,ulevel,utype,remark ");
			strSql.Append(" FROM userinfo ");
			if(strWhere.Trim()!="")
			{
				strSql.Append(" where "+strWhere);
			}
			strSql.Append(" order by " + filedOrder);
			return DbHelperSQL.Query(strSql.ToString());
		}

		/// <summary>
		/// 获取记录总数
		/// </summary>
		public int GetRecordCount(string strWhere)
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("select count(1) FROM userinfo ");
			if(strWhere.Trim()!="")
			{
				strSql.Append(" where "+strWhere);
			}
			object obj = DbHelperSQL.GetSingle(strSql.ToString());
			if (obj == null)
			{
				return 0;
			}
			else
			{
				return Convert.ToInt32(obj);
			}
		}
		/// <summary>
		/// 分页获取数据列表
		/// </summary>
		public DataSet GetListByPage(string strWhere, string orderby, int startIndex, int endIndex)
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("SELECT * FROM ( ");
			strSql.Append(" SELECT ROW_NUMBER() OVER (");
			if (!string.IsNullOrEmpty(orderby.Trim()))
			{
				strSql.Append("order by T." + orderby );
			}
			else
			{
				strSql.Append("order by T.uid desc");
			}
            strSql.Append(")AS Row, uid,uname,utruename,uphone,uemail,uunit,utel,uprovince,ucity,ucounty,uadd,isnull(uprovince,'')+isnull(ucity,'')+isnull(ucounty,'')+isnull(uadd,'') as madd,utype,remark,ulevel from userinfo T ");
			if (!string.IsNullOrEmpty(strWhere.Trim()))
			{
				strSql.Append(" WHERE " + strWhere);
			}
			strSql.Append(" ) TT");
			strSql.AppendFormat(" WHERE TT.Row between {0} and {1}", startIndex, endIndex);
			return DbHelperSQL.Query(strSql.ToString());
		}

        public int GetRecordCountm(string strWhere)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select count(1) FROM Vmobileuserset ");
            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere);
            }
            object obj = DbHelperSQL.GetSingle(strSql.ToString());
            if (obj == null)
            {
                return 0;
            }
            else
            {
                return Convert.ToInt32(obj);
            }
        }
        /// <summary>
        /// 分页获取数据列表
        /// </summary>
        public DataSet GetListByPagem(string strWhere, string orderby, int startIndex, int endIndex)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("SELECT * FROM ( ");
            strSql.Append(" SELECT ROW_NUMBER() OVER (");
            if (!string.IsNullOrEmpty(orderby.Trim()))
            {
                strSql.Append("order by T." + orderby);
            }
            else
            {
                strSql.Append("order by T.uid desc");
            }
            strSql.Append(")AS Row, uid,uname,utruename,uphone,uemail,uunit,utel,uprovince,ucity,ucounty,uadd,isnull(uprovince,'')+isnull(ucity,'')+isnull(ucounty,'')+isnull(uadd,'') as madd,utype,ulevel,aname,abh from Vmobileuserset T ");
            if (!string.IsNullOrEmpty(strWhere.Trim()))
            {
                strSql.Append(" WHERE " + strWhere);
            }
            strSql.Append(" ) TT");
            strSql.AppendFormat(" WHERE TT.Row between {0} and {1}", startIndex, endIndex);
            return DbHelperSQL.Query(strSql.ToString());
        }

		/*
		/// <summary>
		/// 分页获取数据列表
		/// </summary>
		public DataSet GetList(int PageSize,int PageIndex,string strWhere)
		{
			SqlParameter[] parameters = {
					new SqlParameter("@tblName", SqlDbType.VarChar, 255),
					new SqlParameter("@fldName", SqlDbType.VarChar, 255),
					new SqlParameter("@PageSize", SqlDbType.Int),
					new SqlParameter("@PageIndex", SqlDbType.Int),
					new SqlParameter("@IsReCount", SqlDbType.Bit),
					new SqlParameter("@OrderType", SqlDbType.Bit),
					new SqlParameter("@strWhere", SqlDbType.VarChar,1000),
					};
			parameters[0].Value = "userinfo";
			parameters[1].Value = "uid";
			parameters[2].Value = PageSize;
			parameters[3].Value = PageIndex;
			parameters[4].Value = 0;
			parameters[5].Value = 0;
			parameters[6].Value = strWhere;	
			return DbHelperSQL.RunProcedure("UP_GetRecordByPage",parameters,"ds");
		}*/

		#endregion  BasicMethod
		#region  ExtensionMethod
        public string GetZu(int id)
        {
            string zu="没有分组";
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select caname from Vusercategory");
            strSql.Append(" where uid=@uid");
            SqlParameter[] parameters = {
					new SqlParameter("@uid", SqlDbType.Int,4)
			};
            parameters[0].Value = id;
            object o=DbHelperSQL.GetSingle(strSql.ToString(), parameters);
            if(o!=null)
                zu=o.ToString();
            return zu;
        }
		#endregion  ExtensionMethod
	}
}

